<%--
  Created by IntelliJ IDEA.
  User: WheelChen
  Date: 2017/4/16
  Time: 18:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <link rel="stylesheet" href="../../static/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/global.css">
    <link rel="stylesheet" href="../../static/css/table.css">
    <%--<script type="text/javascript">CKEDITOR.replace('ta_ckeditor');</script>--%>
</head>
<body>
<div style="margin: 15px;" id="Vue" v-cloak>

    <div v-show="show">
        <blockquote class="layui-elem-quote">
            <a href="/admin/addrecruitinfo" class="layui-btn layui-btn-small">发布新招聘</a>
            <a href="#" class="layui-btn layui-btn-small" @click="myRecruit">我的招聘</a>
            <a href="#" class="layui-btn layui-btn-small" @click="allRecruit">学院招聘</a>
        </blockquote>
        <fieldset class="layui-elem-field">
            <legend>招聘信息</legend>
            <div class="layui-field-box layui-form">
                <table class="layui-table admin-table">
                    <thead>
                    <tr>
                        <%--<th style="width: 30px;"><input  type="checkbox" lay-filter="allselector" lay-skin="primary"></th>--%>
                        <th>企业</th>
                        <th>类型</th>
                        <th>标题</th>
                        <th>招聘人数</th>
                        <th>状态</th>
                        <th>发布日期</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <%--内容容器--%>
                    <tbody id="content">
                    </tbody>
                </table>
            </div>
        </fieldset>
        <%--分页容器--%>
        <div class="admin-table-page">
            <div id="paged" class="page">
            </div>
        </div>
    </div>

    <div v-show="!show">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>招聘信息</legend>
        </fieldset>
        <form class="layui-form" >
            <div class="layui-form-item">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-inline">
                    <input name="title" class="layui-input" v-model="recruitinfo.title" disabled="true"　readOnly="true" style="width: 500px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">招聘类别</label>
                <div class="layui-input-inline" v-if="recruitinfo.type==1">
                    <input class="layui-input" value="实习招聘" disabled="true"　readOnly="true">
                    <%--<select name="type" lay-filter="type" v-model="recruitinfo.type" lay-search disabled="true"　readOnly="true">--%>
                        <%--<option value="">选择招聘类别</option>--%>
                        <%--<option value="1">实习招聘</option>--%>
                        <%--<option value="2">就业招聘</option>--%>
                    <%--</select>--%>
                </div>
                <div class="layui-input-inline" v-else-if="recruitinfo.type==2">
                    <input class="layui-input" value="就业招聘" disabled="true"　readOnly="true">
                </div>
                <div class="layui-input-inline" v-else>
                    <input class="layui-input" value="---" disabled="true"　readOnly="true">
                </div>
                <label class="layui-form-label">岗位类别</label>
                <div class="layui-input-inline">
                    <input class="layui-input" v-model="positionType">
                    <%--<select name="positiontype" lay-filter="positionType" v-model="recruitinfo.positiontype" lay-search disabled="true"　readOnly="true">--%>
                        <%--<option value="">选择岗位</option>--%>
                    <%--</select>--%>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">工作城市</label>
                <div class="layui-input-inline">
                    <input name="workingcity" class="layui-input" v-model="recruitinfo.workingcity" disabled="true"　readOnly="true">
                </div>
                <label class="layui-form-label">起薪</label>
                <div class="layui-input-inline">
                    <input name="salaryllimit" class="layui-input" v-model="recruitinfo.salaryllimit " disabled="true"　readOnly="true">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">工作内容</label>
                <div class="layui-input-inline">
                    <div name="job" class="layui-textarea"  style="overflow:auto;height: 400px;width:600px;"disabled="disabled" id="job"></div>
                    <%--<textarea name="job" class="layui-input" v-model="recruitinfo.job" disabled="true"　readOnly="true"></textarea>--%>
                    <%--<textarea id="ta_ckeditor" class="ckeditor my-math" cols="20" rows="2" style="overflow:auto"></textarea>--%>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">其他说明</label>
                <div class="layui-input-inline">
                    <textarea name="comment" class="layui-input" v-model="recruitinfo.comment" disabled="true"　readOnly="true"></textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">工作环境照片</label>
                <div class="layui-input-block">
                    <img src="" id="showWorkingPic" style="height: 100px;width: 100px">
                    <%--<input type="file" name="fileUp" id="workingpic" class="layui-upload-file"disabled="true"　readOnly="true">--%>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">招聘人数</label>
                <div class="layui-input-inline">
                    <input name="recruitnum" class="layui-input" v-model="recruitinfo.recruitnum" disabled="true"　readOnly="true">
                </div>
                <label class="layui-form-label">联系人</label>
                <div class="layui-input-inline">
                    <input name="recruitnum" class="layui-input" v-model="recruitinfo.contactperson" disabled="true"　readOnly="true">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-inline">
                    <input name="recruitnum" class="layui-input" v-model="recruitinfo.phone" disabled="true"　readOnly="true">
                </div>
                <label class="layui-form-label">联系邮箱</label>
                <div class="layui-input-inline">
                    <input name="recruitnum" class="layui-input" v-model="recruitinfo.email"disabled="true"　readOnly="true">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block" v-if="recruitinfo.state == 2">
                    <input type="button" class="layui-btn" @click="pass" value="通过">
                    <input type="button" class="layui-btn" @click="nopass" value="不通过">
                    <input type="button" class="layui-btn" @click="reload" value="返回">
                </div>
                <div class="layui-input-block" v-if="recruitinfo.state != 2">
                    <%--<input type="button" class="layui-btn" @click="submit" value="提交">--%>
                    <%--<input type="button" class="layui-btn" @click="temporarilySaved" value="暂存">--%>
                    <input type="button" class="layui-btn" @click="reload" value="返回">
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="../../static/common/ckeditor/ckeditor.js"></script>
<script src="../../static/common/axios.min.js"></script>
<script src="../../static/common/vue.min.js"></script>
<script src="../../static/common/layui/layui.js"></script>
<script src="../../static/common/jquery-3.2.1.js"></script>

<script type="text/javascript" src="../../static/common/jquery/jquery-1.11.1.min.js"></script>
<script>

    var userId = ${sessionScope.currentUser.getId()};
    var positionTypes = [];//所有岗位信息
    var magfacultyInfo = {};

    //获取全部岗位信息
    axios.get('/PositionType/findAll')
        .then(function (response) {
            for (var i = 0;
                 i < response.data.data.length; i++) {
                positionTypes[response.data.data[i].id] = response.data.data[i].posname;
            }
            console.log(positionTypes);
            //有效岗位类别
            var validPositionTypes = response.data.data;
            var html = '';
            for (var i in validPositionTypes) {
                html += '<option value=' + validPositionTypes[i].id + '>' + validPositionTypes[i].posname + '</option>';
            }
            $('select[name=positiontype]').append(html);
        })
        .catch(function (response) {
            console.log(response);
        });
    axios.get('/magfacultyinfo/findOne/'+userId)
        .then(function (response) {
            console.log(response.data);
            magfacultyInfo = response.data.data.magFacultyInfo;
        })
        .catch(function (msg) {
            console.log(msg);
        })
</script>
<!--模板-->
<script type="text/html" id="tpl">
    {{# layui.each(d.data, function(index, item){ }}
    <tr>
        <%--<td><input  type="checkbox" lay-skin="primary"></td>--%>
            <td>{{ item.orginfoFullName|| "-"}}</td>
        <%--招聘类型--%>
        {{# if(item.recruitInfo.type == ""){ }}
        <td>-</td>
        {{# }; }}
        {{# if(item.recruitInfo.type == 1){ }}
        <td>实习</td>
        {{# }; }}
        {{# if(item.recruitInfo.type == 2){ }}
        <td>就业</td>
        {{# }; }}

        <td>{{ item.recruitInfo.title || "-" }}</td>
        <td>{{ item.recruitInfo.recruitnum || "-"}}</td>

        {{# if(item.recruitInfo.state == ""){ }}
        <td>-</td>
        {{# }; }}
        {{# if(item.recruitInfo.state == 1){ }}
        <td>未提交</td>
        {{# }; }}
        {{# if(item.recruitInfo.state == 2){ }}
        <td>待审核</td>
        {{# }; }}
        {{# if(item.recruitInfo.state == 3){ }}
        <td>审核通过</td>
        {{# }; }}
        {{# if(item.recruitInfo.state == 4){ }}
        <td>审核不通过</td>
        {{# }; }}

        <td>{{ getYearMonthDate(item.recruitInfo.publishdate) || "-" }}</td>

        <td>
            {{# if(item.recruitInfo.state == 2){ }}
            <a href="javascript:;" target="_self" data-id="{{item.recruitInfo.id}}" data-opt="more"
               class="layui-btn layui-btn-mini"  style="background-color:#ff5722">审核</a>
            {{# }; }}
            {{# if(item.recruitInfo.state != 2){ }}
            <a href="javascript:;" target="_self" data-id="{{item.recruitInfo.id}}" data-opt="more"
               class="layui-btn layui-btn-mini">查看详情</a>
            {{# }; }}
            <%--<a href="javascript:;"   data-opt="edit" class9="layui-btn layui-btn-mini">编辑</a>--%>
            <%--<a href="javascript:;" data-opt="delete" class="layui-btn layui-btn-danger layui-btn-mini">删除</a>--%>
        </td>
    </tr>
    {{# }); }}
</script>
<script src="../../static/js/admin/recruitInfos.js"></script>
</body>
</html>
